package com.company.common.utils;

import java.util.LinkedHashMap;

public class MakerwitBean extends LinkedHashMap<String, Object> {

    private static final long serialVersionUID = 1L;

    public static MakerwitBean create() {
        return new MakerwitBean();
    }

    @Override
    public Object put(String key, Object value) {
        return super.put(customKey(key), value);
    }

    /**
     * 将Key转为小写
     *
     * @param key KEY
     * @return 小写KEY
     */
    public static String customKey(String key) {
        if (null != key) {
            key = key.toLowerCase();
        }
        return key;
    }


    /**
     * 将Key转为大写
     *
     * @param key KEY
     * @return 大写KEY
     */
    public static String custouKey(String key) {
        if (null != key) {
            key = key.toUpperCase();
        }
        return key;
    }

    public MakerwitBean set(String field, Object value) {
        this.put(field, value);
        return (MakerwitBean) this;
    }
}
